﻿#ifndef PROJECTFILEWATCHER_H
#define PROJECTFILEWATCHER_H

#include <QObject>
#include <QtQml>
#include <QFileSystemWatcher>

#include "../common/stdafx.h"
#include "../common/singleton.h"

class ProjectFileWatcher : public QObject
{
    Q_OBJECT
    QML_NAMED_ELEMENT(ProjectFileWatcher)
    Q_PROPERTY_AUTO(QString, defDirPath)
private:
    explicit ProjectFileWatcher(QObject *parent = nullptr);

public:
    SINGLETON(ProjectFileWatcher);
    void initialize();
    Q_INVOKABLE QString getFileFullPathByPid(const QString &pid);
    Q_INVOKABLE bool existsByPid(const QString &pid);
    Q_INVOKABLE QString readFileDataByPid(const QString &pid);
    Q_INVOKABLE bool writeFileDataByPid(const QString &pid, const QString &data);
    Q_INVOKABLE static bool exists(const QString &fileName);
    Q_INVOKABLE bool removeByPid(const QString &pid);

signals:

private:

};

#endif // PROJECTFILEWATCHER_H
